/**
 * 
 */
package com.higherground.api.impl.hibernate.domain;

import java.util.Date;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import com.higherground.api.domain.IAddress;
import com.higherground.api.domain.IPerson;
import com.higherground.api.domain.IPhone;
import com.higherground.api.domain.IRace;

/**
 * @author jimmy
 * 
 */

@Entity
@Table(name = "person")
public abstract class PersonImpl implements IPerson {

	private long personId;
	private String firstName;
	private String lastName;
	private Date dob;
	private int age;
	private String maritalStatus;
	private String ssn;
	private IRace race;
	private String citizenship;
	private String emailId;
	private String gender;
	private IAddress address;
	private List<IPhone> phones;

	/**
	 * 
	 */
	public PersonImpl() {
		// TODO Auto-generated constructor stub
	}

	/**
	 * @param personId
	 * @param firstName
	 * @param lastName
	 * @param dob
	 * @param age
	 * @param maritalStatus
	 * @param ssn
	 * @param race
	 * @param citizenship
	 * @param emailId
	 * @param gender
	 * @param address
	 * @param phones
	 */
	public PersonImpl(long personId, String firstName, String lastName,
			Date dob, int age, String maritalStatus, String ssn, IRace race,
			String citizenship, String emailId, String gender,
			IAddress address, List<IPhone> phones) {
		this.personId = personId;
		this.firstName = firstName;
		this.lastName = lastName;
		this.dob = dob;
		this.age = age;
		this.maritalStatus = maritalStatus;
		this.ssn = ssn;
		this.race = race;
		this.citizenship = citizenship;
		this.emailId = emailId;
		this.gender = gender;
		this.address = address;
		this.phones = phones;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.higherground.api.domain.IPerson#getPersonId()
	 */
	@Override
	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	@Column(name = "person_id", unique = true, nullable = false)
	public long getPersonId() {
		// TODO Auto-generated method stub
		return this.personId;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.higherground.api.domain.IPerson#setPersonId(long)
	 */
	@Override
	public void setPersonId(long personId) {
		// TODO Auto-generated method stub
		this.personId = personId;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.higherground.api.domain.IPerson#getFirstName()
	 */
	@Override
	@Column(name = "first_name", nullable = false, length = 45)
	public String getFirstName() {
		// TODO Auto-generated method stub
		return this.firstName;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.higherground.api.domain.IPerson#setFirstName(java.lang.String)
	 */
	@Override
	public void setFirstName(String firstName) {
		// TODO Auto-generated method stub
		this.firstName = firstName;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.higherground.api.domain.IPerson#getLastName()
	 */
	@Override
	@Column(name = "last_name", nullable = false, length = 45)
	public String getLastName() {
		// TODO Auto-generated method stub
		return this.lastName;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.higherground.api.domain.IPerson#setLastName(java.lang.String)
	 */
	@Override
	public void setLastName(String lastName) {
		// TODO Auto-generated method stub
		this.lastName = lastName;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.higherground.api.domain.IPerson#getDob()
	 */
	@Override
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "dob", length = 19)
	public Date getDob() {
		// TODO Auto-generated method stub
		return this.dob;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.higherground.api.domain.IPerson#setDob(java.util.Date)
	 */
	@Override
	public void setDob(Date dob) {
		// TODO Auto-generated method stub
		this.dob = dob;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.higherground.api.domain.IPerson#getAge()
	 */
	@Override
	@Column(name = "age")
	public int getAge() {
		// TODO Auto-generated method stub
		return this.age;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.higherground.api.domain.IPerson#setAge(int)
	 */
	@Override
	public void setAge(int age) {
		// TODO Auto-generated method stub
		this.age = age;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.higherground.api.domain.IPerson#getMaritalStatus()
	 */
	@Override
	@Column(name = "marital_status", length = 45)
	public String getMaritalStatus() {
		// TODO Auto-generated method stub
		return this.maritalStatus;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * com.higherground.api.domain.IPerson#setMaritalStatus(java.lang.String)
	 */
	@Override
	public void setMaritalStatus(String maritalStatus) {
		// TODO Auto-generated method stub
		this.maritalStatus = maritalStatus;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.higherground.api.domain.IPerson#getSsn()
	 */
	@Override
	@Column(name = "ssn", length = 19)
	public String getSsn() {
		// TODO Auto-generated method stub
		return this.ssn;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.higherground.api.domain.IPerson#setSsn(java.lang.String)
	 */
	@Override
	public void setSsn(String ssn) {
		// TODO Auto-generated method stub
		this.ssn = ssn;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.higherground.api.domain.IPerson#getRace()
	 */
	@Override
	@ManyToOne(targetEntity = RaceImpl.class, fetch = FetchType.LAZY)
	@JoinColumn(name = "race_id")
	public IRace getRace() {
		// TODO Auto-generated method stub
		return this.race;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * com.higherground.api.domain.IPerson#setRace(com.higherground.api.domain
	 * .IRace)
	 */
	@Override
	public void setRace(IRace race) {
		// TODO Auto-generated method stub
		this.race = race;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.higherground.api.domain.IPerson#getCitizenship()
	 */
	@Override
	@Column(name = "citizenship", length = 45)
	public String getCitizenship() {
		// TODO Auto-generated method stub
		return this.citizenship;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.higherground.api.domain.IPerson#setCitizenship(java.lang.String)
	 */
	@Override
	public void setCitizenship(String citizenship) {
		// TODO Auto-generated method stub
		this.citizenship = citizenship;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.higherground.api.domain.IPerson#getEmailId()
	 */
	@Override
	@Column(name = "email_id", length = 100)
	public String getEmailId() {
		// TODO Auto-generated method stub
		return this.emailId;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.higherground.api.domain.IPerson#setEmailId(java.lang.String)
	 */
	@Override
	public void setEmailId(String emailId) {
		// TODO Auto-generated method stub
		this.emailId = emailId;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.higherground.api.domain.IPerson#getGender()
	 */
	@Override
	@Column(name = "gender", length = 15)
	public String getGender() {
		// TODO Auto-generated method stub
		return this.gender;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.higherground.api.domain.IPerson#setGender(java.lang.String)
	 */
	@Override
	public void setGender(String gender) {
		// TODO Auto-generated method stub
		this.gender = gender;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.higherground.api.domain.IPerson#getAddress()
	 */
	@Override
	@ManyToOne(targetEntity = AddressImpl.class, fetch = FetchType.LAZY)
	@JoinColumn(name = "address_id")
	public IAddress getAddress() {
		// TODO Auto-generated method stub
		return this.address;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * com.higherground.api.domain.IPerson#setAddress(com.higherground.api.domain
	 * .IAddress)
	 */
	@Override
	public void setAddress(IAddress address) {
		// TODO Auto-generated method stub
		this.address = address;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.higherground.api.domain.IPerson#getPhones()
	 */
	@Override
	@OneToMany(targetEntity = PhoneImpl.class, fetch = FetchType.LAZY)
	@JoinColumn(name = "phone_id")
	public List<IPhone> getPhones() {
		// TODO Auto-generated method stub
		return this.phones;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.higherground.api.domain.IPerson#setPhones(java.util.List)
	 */
	@Override
	public void setPhones(List<IPhone> phones) {
		// TODO Auto-generated method stub
		this.phones = phones;
	}

}
